import random as r

door_num = [1, 2, 3]
door = ['goat', 'goat', 'car']
r.shuffle(door)

choice = eval(input("请选择1-3号门："))
assert choice == 1 or choice == 2 or choice == 3, '请输入1、2、3号门'
door_num.remove(choice)  # 从门号中删除个人选择和汽车相应的号码以便与主持人每次打开的都是另一扇有山羊的门
if choice != door.index('car') + 1:  # 如果个人选择就是汽车,则不进行操作,下一步直接打开门牌号中第一个门
    door_num.remove(door.index('car') + 1)
print(door_num[0], "号门后面是山羊，你想改选另一扇门吗？")
change = input("y/n:")
if choice == door.index('car') + 1 and change != 'y':  # 判断初始选择是否为汽车且不更改选择
    print("恭喜您获的汽车")
else:
    print("很抱歉您没有获得汽车")
